import type { GetHouseByOwnerIdReq, GetHouseByOwnerIdRes, GetHouseDetailReq, GetHouseDetailRes, SetHouseRentReq, SetHouseRentRes, CheckHouseRentReq, CheckHouseRentRes, QueryHouseListReq, QueryHouseListRes } from './types';
import { get, post } from '@/utils/request';

/**
 * 房屋信息相关接口
 */

/** 根据业主ID获取房屋信息 */
export const getHouseByOwnerId = (params: GetHouseByOwnerIdReq) => 
  get<GetHouseByOwnerIdRes>('/house/getHouseByOwnerId', { params });

/** 根据房屋ID获取房屋详情 */
export const getHouseDetail = (params: GetHouseDetailReq) => 
  get<GetHouseDetailRes>('/house/detail', { params });

/** 设置房屋出租信息 */
export const setHouseRent = (data: SetHouseRentReq) => 
  post<SetHouseRentRes>('/house/setHouseRent', { data });

/** 检查房屋出租状态 */
export const checkHouseRent = (params: CheckHouseRentReq) => 
  get<CheckHouseRentRes>('/house/chackHouseIsRent', { params });

/** 查询房源列表 */
export const queryHouseList = (data: QueryHouseListReq) => 
  post<QueryHouseListRes>('/house/queryList', { data });

/**
 * 房屋API对象
 */
export const HouseApi = {
  getHouseByOwnerId,
  getHouseDetail,
  setHouseRent,
  checkHouseRent,
  queryHouseList
};
